/*
 * Copyright (c) 2023 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef EMULEX_INTERFACE_PCIE_CARD_H
#define EMULEX_INTERFACE_PCIE_CARD_H

#include <mc/core/timer.h>
#include <device_tree/interface/PCIeCard.h>
#include <pldm_over_mctp/pldm_over_mctp_emulex.h>

namespace dev {
using pldm_over_mctp_emulex_ptr = std::shared_ptr<pldm_over_mctp_emulex>;

class PCIeCard : public mc::engine::interface<PCIeCard, gen::PCIeCard> {
public:
    PCIeCard()  = default;
    ~PCIeCard() {
        stop_pldm_update_task();
    }
public:
    uint8_t SystemId;
    void start_pldm_update_task_emulex(pldm_over_mctp_emulex_ptr pldm_over_mctp,
                                       mc::milliseconds      interval);
    void stop_pldm_update_task();

private:
    mc::core::timer*      m_pldm_timer;
    pldm_over_mctp_emulex_ptr m_pldm_over_mctp_emulex;
    bool update_cardinfo_by_pldm();
    
    
};

} // namespace dev

#endif // PCIE_CARD_H